package org.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;

import org.demo.entity.Users;

import java.util.List;

@Mapper
public interface UsersMapper extends BaseMapper<Users> {
    //根据用户名查询用户
//    @Select("select * from users where username=#{username}")
    Users findByUserName(String username);

    List<Users> listAll (@Param("param") Users users);

    //添加
//    @Insert("insert into users (username,password,role_id,email,phone,nickname,user_pic,create_time,update_time)"+
//            "values(#{username},#{password},#{roleId},#{email},#{phone},#{nickname},#{userPic},now(),now())")
    void add(@Param("param") Users user);

    void updateUser(@Param("param") Users user);

    void updateAvatar(String avatarUrl,String id);

    void updatePwd(String newPwd,String id);
}
